package com.sky.domain;

import lombok.Data;

import java.util.List;
import java.util.Stack;

@Data
public class MultiDelayMessage <T>{

    private T data;

    private List<Long> delayMills;

    public MultiDelayMessage(T data, List<Long> delayMills) {
        this.data = data;
        this.delayMills = delayMills;
    }

    public static <T> MultiDelayMessage<T> of(T data, List<Long> delayMills){
        return new MultiDelayMessage<>(data, delayMills);
    };

    // 获取并移除下一个延迟时间
    public Long removeNextDelay(){
        return delayMills.remove(0);
    }

    // 判断是否存在下一个延迟时间
    public boolean hasNextDelay(){
        return !delayMills.isEmpty();
    }

}
